<template>
    <div>
        <van-nav-bar :title="navTitle" :border="false" :left-arrow="isGoBack" @click-left="goBack" />
    </div>
</template>

<script setup>
import { watch, ref, computed } from "vue"
import { useRouter } from 'vue-router';

const route = useRoute()
const navTitle = computed(() => {
    if (Object.keys(route.query).length > 0 && route.query.type == 'edit') {
        return '修改'
    }
    return router.currentRoute.value.meta.title
})




const isGoBack = ref(false)
const router = useRouter()
watch(() => router, (newV) => {
    const { index } = newV.currentRoute.value.meta
    if (index > 1) {
        isGoBack.value = true
    } else {
        isGoBack.value = false
    }
}, {
    immediate: true,
    deep: true
})
function goBack() {
    router.go(-1)
}
</script>
<style></style>
<style lang="scss" scoped>
::v-deep(.van-nav-bar) {
    // background: rgba(227, 252, 255, 1);
    background: transparent;

    // filter: blur(74px);
    .van-icon {
        color: rgba(0, 0, 0, 0.9)
    }

}
</style>